<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript" src="/js/jquery-1.11.1.min.js"></script>
</head>
<body>
<form name="form1" method="post" action="/attachment/dotest">
    文件<input type="file" id="upload" name="attachment"><br/>
<{$captcha}><input type="text" name="code" value=""/>
    <input type="submit" value="提交">
</form>
<script type="text/javascript">
    $.fn.filevalue = function(){
        var obj = this[0];

        if(obj){
            //ie
            if (window.navigator.userAgent.indexOf("MSIE")>=1){
                obj.select();
                return document.selection.createRange().text;
            }else if(window.navigator.userAgent.indexOf("Firefox")>=1){

                //firefox
                if(obj.files){
                    return window.URL.createObjectURL(obj.files.item(0));
                }
                return obj.value;
            }
            return obj.value;
        }
    };
    $(function(){
        $("#upload").change(function(){
            alert($(this).filevalue());
        });
    })
</script>
</body>
</html>